#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
string Bignum3(string& num1 , string& num2){
    int len1,len2;
    cin>>num1>>num2;  
    len1=num1.length();
    len2=num2.length();
    vector<int> v1,v2;
    for(char c:num1){
        v1.push_back(c-'0');
    }
    for(char c:num2){
        v2.push_back(c-'0');
    }
    reverse(v1.begin(), v1.end());
    reverse(v2.begin(), v2.end());
    vector<int> output(len1+len2,0);
    for(int i=0;i<len1;i++){
        for(int j=0;j<len2;j++){
            output[i+j]=v1[i]*v2[j];
    }
}
    for(int i=0;i<len1+len2;i++){
        if(output[i]>9){
            output[i+1]+=output[i]/10;
            output[i]%=10;
        }else{
continue;
        }
    }
    reverse(output.begin(), output.end());
    int start=0;
    while(start<output.size()&&output[start]==0){
        start++;        }
        string result;
    for(int i=start;i<output.size();i++){
        result+=to_string(output[i]);
    }
   return result;
}
string Bignum2(string& num1 , string& num2)
{
    
    int len1,len2;
    cin>>num1>>num2;
    len1=num1.length();
    len2=num2.length();
   vector<int> res1, res2;
for (char c : num1) {
    res1.push_back(c - '0');  
}
for (char c : num2) {
    res2.push_back(c - '0');
}
reverse(res1.begin(), res1.end());
reverse(res2.begin(), res2.end());
vector<int> output;
if(num1>num2){
    for(int i=0;i<len1;i++){
        if(res1[i]>=res2[i]){
            output.push_back(res1[i]-res2[i]);
    }
    else{
        output.push_back(10+res1[i]-res2[i]);
        res1[i+1]--;
    }
    reverse(output.begin(), output.end());
   }

   int start=0;
   while(start<output.size()&&output[start]==0){
    start++;
   }
   string result;
   for(int i=start;i<output.size();i++){
         result+=to_string(output[i]);
   }
   return result;
   } }
   




int compare( const vector<int>& v1,const vector<int>& v2){
    for(int i=0;i<v1.size();i++){
        if(v1[i]<=v2[i]) {
            return 0;
        }
        if(v1[i]>v2[i]) {
            return 1;
        }
    }
}


int main(){
    string num1,num2;
    int len1,len2;
    cin>>num1>>num2;
    len1=num1.length();
    len2=num2.length();
    vector<int> v1,v2,v4,v5;
    for(char c:num1){
        v1.push_back(c-'0');
    }
    for(char c:num2){
        v2.push_back(c-'0');
    }
    vector<int> output;
    if(num1<num2){
        swap(num1,num2);
        swap(len1,len2);
        swap(v1,v2);
    }
   vector<int> v3(v1.begin(),v1.begin()+len2);
   for(int j=0;j<=len1-len2+1;j++){
    if(compare(v3,v2)==1){
        for(int i=9;i>=0;i--){
        string s=to_string(i);
         for(char c:Bignum3(num2,s)){
             v4.push_back(c-'0');
         }
         if(compare(v4,v2)==0){
         output.push_back(i);
        }
    }
    string v2_str;
for (int num : v2) {
    v2_str += to_string(num);
}
string v4_str;
for (int num : v4) {
    v4_str += to_string(num);
}
for(char c:Bignum2(v2_str, v4_str)){
    v5.push_back(c-'0');
}
    v3=v5;
}
 if(compare(v3,v2)==0){
       output.push_back(0);
       v3.push_back(v1[len2+j+1]);
    }
}
int start=0;
    while(start<output.size()&&output[start]==0){
        start++;        }
        string result;
    for(int i=start;i<output.size();i++){
        result+=to_string(output[i]);
    }
    return 0;
}

    